Puppet - How to Use [class setting]
2014/01/26 |
It's possible to manage some resources by using "class" section like follows.
|
|
[1] | It's an example to define and use "sample01" class. |
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp class sample01 { file { '/home/testfile.txt': ensure => file, owner => 'root', group => 'root', mode => 644, content => 'This is the puppet test file.', } user { 'cent': ensure => present, home => '/home/cent', managehome => true, password => '$6$0XTc2rjlxxxxxxxx', } } node 'www.srv.world' { include 'sample01' } |
[2] | It's an example to use inheritance of a class. The "sample01" and "sample02" class are both applied to "www.srv.world" by this manifest. |
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp class sample01 { file { '/home/testfile.txt': ensure => file, owner => 'root', group => 'root', mode => 644, content => 'This is the puppet test file.', } user { 'cent': ensure => present, home => '/home/cent', managehome => true, password => '$6$0XTc2rjlxxxxxxxx', } } class sample02 inherits sample01 { file { '/home/testfile2.txt': ensure => file, owner => 'root', group => 'wheel', content => 'test file2', } } node 'www.srv.world' { include 'sample02' } |